﻿<script>
    $(function () {
        $('.readonly').attr('disabled', 'disabled');
        //$('.easyui-datetimebox').attr('disabled', '1');
        //$('#ui_grave_relative_tel').removeAttr('disabled');        
                       
        //$('#ui_grave_relative_tel').textbox({
        //    prompt: '请输入电话进行查询',
        //    icons: [{
        //        iconCls: 'icon-search',
        //        handler: function (e) {
        //            var tel = $(e.data.target).textbox('getValue');
        //            getRelativeByTel(tel)
        //        }
        //    }]
        //});

        //$("#ui_grave_saleform").find('input').bind('keyup', function (ev) {
        //    alert(ev.target);
        //    if (ev.keyCode == '13') {
        //       //处理回车，不生效？？？？               
        //    }
        //});
    });

    function getRelativeByTel(tel) {
        if (!tel) {
            $.show_warning("提示", "请输入联系人电话！");
            return;
        }
        para = {};
        para.action = "getRelativeByTel";
        para.timespan = new Date().getTime();
        para.tel = tel;
        $.ajax({
            url: "ashx/bg_relative.ashx",
            data: para,
            type: "POST",
            dataType: "json",
            success: function (data) {
                var dr = data.msg;
                if (data.success && dr) {                    
                    $('#ui_grave_relative_id').val(dr.id);
                    $('#ui_grave_relative_name').textbox('setValue', dr.name);
                    $('#ui_grave_relative_tel').textbox('setValue', dr.tel);
                    $('#ui_grave_relative_relation').textbox('setValue', dr.relation);
                    $('#ui_grave_relative_company').textbox('setValue', dr.company);
                    $('#ui_grave_relative_cardno').textbox('setValue', dr.cardno);
                    $('#ui_grave_relative_addr').textbox('setValue', dr.addr);
                    $('#ui_grave_relative_title').textbox('setValue', dr.title);
                } else if (dr) {
                    $.show_warning("提示", data.msg);
                } else {
                    $.show_warning("提示", "指定电话的联系人不存在！");
                }
            }
        });
    }
</script>
<div style="padding: 1px; overflow: hidden">
    <form id="ui_grave_saleform" method="post" >
        
        <div title="联系人信息" style="padding: 10px">
            <table style="width:95%">
                <tr>
                    <td>骨灰盒位置：</td>
                    <td colspan="3">
                        <input class="easyui-textbox readonly" type="text" disabled ="disabled" name="ui_grave_location" id="ui_grave_location" style="width:95%" />                                           
                        <input type="hidden" name="ui_grave_relative_id" id="ui_grave_relative_id" />
                        <input type="hidden" name="ui_grave_id" id="ui_grave_id" />
                    </td>
                </tr>
                <tr>
                    <td>价格:</td>
                    <td>
                        <input class="easyui-numberbox" value="0" type="text" disabled ="disabled" name="ui_grave_price" id="ui_grave_price" data-options="min:0,precision:2,required:true"  />                                                                   
                    </td>
                    <td >支付金额:</td>
                    <td >
                        <input type="text" value="0" class="easyui-numberbox" id="ui_grave_paid" name="ui_grave_paid" data-options="min:0,precision:2,required:true" />
                    
                    </td>
                </tr>
                <tr>
                    <td colspan="4" style="background-color:#cccccc">联系人信息</td>
                </tr>
                <tr>                    
                    <td>联系人姓名:</td>
                    <td>
                        <input class="easyui-textbox  readonly" id="ui_grave_relative_name" name="ui_grave_relative_name" data-options="required:true" />
                    </td>
                    <td>联系电话:</td>
                    <td>
                        <input class="easyui-searchbox" data-options="prompt:'请输入联系电话查询',searcher:getRelativeByTel"  name="ui_grave_relative_tel" id="ui_grave_relative_tel" style="width:180px" />            
                    </td>                    
                </tr>
                <tr>                    
                    <td>身份证:</td>
                    <td>
                        <input class="easyui-textbox  readonly" type="text" name="ui_grave_relative_cardno" id="ui_grave_relative_cardno"  data-options="required:true" />
                    </td>
                    <td>&nbsp;</td>
                    <td >
                        &nbsp;</td>                    
                </tr>           
                <tr>
                    <td>单位名称:</td>
                    <td>
                        <input class="easyui-textbox  readonly" id="ui_grave_relative_company" name="ui_grave_relative_company"  />
                    </td>
                    <td>职务:</td>
                    <td>
                        <input class="easyui-textbox  readonly" id="ui_grave_relative_title" name="ui_grave_relative_title"  />
                    </td>
                </tr>
                <tr>
                    <td>通信地址:</td>
                    <td colspan="3">
                        <input class="easyui-textbox  readonly" name="ui_grave_relative_addr"  id="ui_grave_relative_addr"  data-options="required:true" style="width: 95%" />
                    </td>
                </tr>                
            </table>
        </div>
            
     </form>    
</div>
